﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using Daybreak.Core.Network.Udp;
using TestUserPacket;

namespace ChatClient
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write("Enter server IP: ");
            string ip = Console.ReadLine();

            Console.Write("Enter port: ");
            string port = Console.ReadLine();

            Console.Write("Enter nickname: ");
            string nick = Console.ReadLine();
            
            UdpNetClient c = new UdpNetClient(Path.GetFullPath(@"TestUserPacket.dll"));
            c.Connect(ip, int.Parse(port));
            if (c.Connected)
            {
                Console.WriteLine("Enter message ...");

                while (true)
                {
                    string message = Console.ReadLine();

                    Message m = new Message();
                    m.Data = Encoding.Unicode.GetBytes(nick + ": " + message);
                    c.Send(m);
                }
            }
        }
    }
}
